package cn.edu.nju.software.cdiy.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

public class NetworkAdapter extends Hardware implements Comparable<NetworkAdapter>, Serializable {

	private static final long serialVersionUID = 6724904291045857401L;
	private int id;
	// 型号1
	private String model;// 网卡型号

	// 外键品牌表1
	private BRD_NET brand;// 网卡品牌

	// 外键码表3
	private Value netType;// 网络类型
	private Value transmitSpeed;// 传输速率

	// 外键接口表2
	private Interface busType;// 总线接口类型
	private Interface portType;// 网线接口类型

	// 一对多关系
	private Set<NET_Standard> nstdSet;// 网络标准

	// 次要指标6
	private String transMedium;// 传输介质
	private String CPU;// 网卡芯片
	private int fullDuplex;// 全双工
	private int remoteWakeup;// 远程唤醒
	private String LED;// LED显示器
	private String other;// 其他
	private String os;// 操作系统

	private String CSPhone;// 客服电话
	private String qualityPolicy;// 质保政策
	private String qualityTime;// 质保时间
	private String qualityContent;// 质保具体内容

	// 管理类参数6
	private int iPrice;// 入库价格
	private int oPrice;// 出库价格
	private double performance;// 性能
	private Date inStorageTime;// 入库时间
	private String imgPath;// 图片路径
	private Value state;// 状态 //外键；{0:审核中 1:已通过}
	private double wScore;// 网友评分
	private double zScore;// 专家评分
	private int supplier;// 供货商

	private int sale;// 销售量
	private int ratedPower;// 预留信息
	private String rsv3;// 预留信息

	public Set<NET_Standard> getNstdSet() {
		return nstdSet;
	}

	public void setNstdSet(Set<NET_Standard> nstdSet) {
		this.nstdSet = nstdSet;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public String getTransMedium() {
		return transMedium;
	}

	public void setTransMedium(String transMedium) {
		this.transMedium = transMedium;
	}

	public double getwScore() {
		return wScore;
	}

	public void setwScore(double wScore) {
		this.wScore = wScore;
	}

	public double getzScore() {
		return zScore;
	}

	public void setzScore(double zScore) {
		this.zScore = zScore;
	}

	public BRD_NET getBrand() {
		return brand;
	}

	public void setBrand(BRD_NET brand) {
		this.brand = brand;
	}

	public Value getNetType() {
		return netType;
	}

	public void setNetType(Value netType) {
		this.netType = netType;
	}

	public Value getTransmitSpeed() {
		return transmitSpeed;
	}

	public void setTransmitSpeed(Value transmitSpeed) {
		this.transmitSpeed = transmitSpeed;
	}

	public Interface getBusType() {
		return busType;
	}

	public void setBusType(Interface busType) {
		this.busType = busType;
	}

	public Interface getPortType() {
		return portType;
	}

	public void setPortType(Interface portType) {
		this.portType = portType;
	}

	public String getCPU() {
		return CPU;
	}

	public void setCPU(String cPU) {
		CPU = cPU;
	}

	public int getFullDuplex() {
		return fullDuplex;
	}

	public void setFullDuplex(int fullDuplex) {
		this.fullDuplex = fullDuplex;
	}

	public int getRemoteWakeup() {
		return remoteWakeup;
	}

	public void setRemoteWakeup(int remoteWakeup) {
		this.remoteWakeup = remoteWakeup;
	}

	public String getLED() {
		return LED;
	}

	public void setLED(String lED) {
		LED = lED;
	}

	public String getOther() {
		return other;
	}

	public void setOther(String other) {
		this.other = other;
	}

	public String getOs() {
		return os;
	}

	public void setOs(String os) {
		this.os = os;
	}

	public int getiPrice() {
		return iPrice;
	}

	public void setiPrice(int iPrice) {
		this.iPrice = iPrice;
	}

	public int getoPrice() {
		return oPrice;
	}

	public void setoPrice(int oPrice) {
		this.oPrice = oPrice;
	}

	public double getPerformance() {
		return performance;
	}

	public void setPerformance(double performance) {
		this.performance = performance;
	}

	public Date getInStorageTime() {
		return inStorageTime;
	}

	public void setInStorageTime(Date inStorageTime) {
		this.inStorageTime = inStorageTime;
	}

	public String getImgPath() {
		return imgPath;
	}

	public void setImgPath(String imgPath) {
		this.imgPath = imgPath;
	}

	public Value getState() {
		return state;
	}

	public void setState(Value state) {
		this.state = state;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getSupplier() {
		return supplier;
	}

	public void setSupplier(int supplier) {
		this.supplier = supplier;
	}

	public int getSale() {
		return sale;
	}

	public void setSale(int sale) {
		this.sale = sale;
	}

	public int getRatedPower() {
		return ratedPower;
	}

	public void setRatedPower(int ratedPower) {
		this.ratedPower = ratedPower;
	}

	public String getRsv3() {
		return rsv3;
	}

	public void setRsv3(String rsv3) {
		this.rsv3 = rsv3;
	}

	@Override
	public int compareTo(NetworkAdapter o) {

		Date now = new Date();

		// this的热度
		long gap = now.getTime() - inStorageTime.getTime();
		int gapDay = (int) (gap / (24 * 3600 * 1000));

		double nowHot = sale / gapDay;

		// 参数的hot
		long oGap = now.getTime() - o.getInStorageTime().getTime();
		int oGapDay = (int) (oGap / (24 * 3600 * 1000)) + 1;

		double oHot = o.getSale() / oGapDay;

		// 降序排列
		if (nowHot > oHot)
			return -1;
		else if (nowHot == oHot)
			return 0;
		else
			return 1;
	}

	public String getCSPhone() {
		return CSPhone;
	}

	public void setCSPhone(String cSPhone) {
		CSPhone = cSPhone;
	}

	public String getQualityPolicy() {
		return qualityPolicy;
	}

	public void setQualityPolicy(String qualityPolicy) {
		this.qualityPolicy = qualityPolicy;
	}

	public String getQualityTime() {
		return qualityTime;
	}

	public void setQualityTime(String qualityTime) {
		this.qualityTime = qualityTime;
	}

	public String getQualityContent() {
		return qualityContent;
	}

	public void setQualityContent(String qualityContent) {
		this.qualityContent = qualityContent;
	}

}
